package com.zrx.zrxpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zrx.zrxpicturebackend.model.dto.user.UserQueryRequest;
import com.zrx.zrxpicturebackend.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zrx.zrxpicturebackend.model.vo.LoginUserVO;
import com.zrx.zrxpicturebackend.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author zrx
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-01-16 21:30:38
*/
public interface UserService extends IService<User> {
    /**
     * 用户注册
     * @param userAccount 用户账号
     * @param userPassword 用户密码
     * @param checkPassword 确认密码
     * @return 用户id
     */
    long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 用户登录
     *
     * @param userAccount  用户账户
     * @param userPassword 用户密码
     * @return 脱敏后的用户信息
     */
    LoginUserVO userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 转换成脱密后的用户信息
     * @param user 用户信息
     * @return 脱密后的用户信息
     */
    LoginUserVO getLoginUserVO(User user);

    /**
     * 加密
     * @param userPassword 用户密码
     * @return 加密后的密码
     */
    String encryptPassword(String userPassword);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    Boolean userLogout(HttpServletRequest request);

    UserVO getUserVO(User user);

    List<UserVO> getUserVOList(List<User> userList);

    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    /**
     * 是否为管理员
     *
     * @param user
     * @return
     */
    boolean isAdmin(User user);

}
